package com.groupbuying.cheetah.utils;


/**
 * @Author gxy
 * @Description 返回参数枚举类
 * @Date 2019/1/28 9:22
 * 0.成功<br/>
 * 1.失败<br/>
 * 2.请求参数为空<br/>
 * 3.请求参数不正确<br>
 * 4.重复下单<br>
 * 5.用户未登录<br>
 **/

public enum ReturnCodeEnum {
	SUCCESS(0, "成功"),
	FIAL(1, " 失败"),
	PARAMNULL(2, "请求参数为空"),
	PARAMERROR(3, "请求参数不正确"),
	ORDERREPEAT(4, "重复下单"),
	CUSTOMERNOTLOGIN(5, "用户未登录");

	private Integer key;
	private String value;

	private ReturnCodeEnum(Integer key, String value) {
		this.key = key;
		this.value = value;
	}

	public Integer getKey() {
		return key;
	}

	public void setKey(Integer key) {
		this.key = key;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public static String getValue(Integer key) {
		for (ReturnCodeEnum st : ReturnCodeEnum.values()) {
			if (key.equals(st.key)) {
				return st.value;
			}
		}
		return "";
	}
}
